package br.com.sgpv2.controler.verba;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


@Controller
public class ParametroVerbaController {

	
//	@Autowired
//	private  parametroVerbaService; 
	
	
	@RequestMapping(value = "parametroVerba/pesquisar", method = RequestMethod.GET)
	public String pesquisar(Model model, HttpServletRequest request) throws Exception {
//		List<ImpostoRenda> impostos = parametroVerbaService.consultarPorMesAno(mes, ano);
//		model.addAttribute("impostos", impostos);
		
		return "parametroVerba/parametros";
	}
	
	@RequestMapping(value = "parametroVerba/incluir", method = RequestMethod.GET)
	public String getInclusaoPage(Model model) throws Exception {
		
//		model.addAttribute("impostoBean", new ImpostoRenda());
		model.addAttribute("titleBotaoAcao", "Salvar");
		
		return "parametroVerba/parametroVerba-incluir";
	}
	
	@RequestMapping(value = "parametroVerba/incluirParametro", method = RequestMethod.POST)
	public String salvar(Model model) throws Exception {
		
//	public String salvar(ImpostoRenda parametroVerba, Model model) throws Exception {
//		parametroVerbaService.salvar(parametroVerba);
		
		return "redirect:pesquisar";
	}
	
	@RequestMapping(value = "parametroVerba/excluir/{pk}", method = RequestMethod.GET)
	public String excluir(@PathVariable Integer pk, Model model) throws Exception {
//		ImpostoRenda imposto = parametroVerbaService.buscar(pk);
//		if(imposto !=null){
//			parametroVerbaService.remover(imposto);
//		}
//		
		return "redirect:../pesquisar";
	}
	
	@RequestMapping(value = "/parametroVerba/atualizar/{pk}", method = RequestMethod.GET)
	public String getAlteracaoPage(@PathVariable Integer pk,Model model) throws Exception {

//		ImpostoRenda imposto = parametroVerbaService.buscar(pk);
//		model.addAttribute("impostoBean", imposto);
		
		model.addAttribute("titleBotaoAcao", "Alterar");
		
		return "parametroVerba/parametroVerba-alterar";
	}
	
	@RequestMapping(value = "parametroVerba/alterarParametro", method = RequestMethod.POST)
	public String alterar() throws Exception {
		
//	public String alterar(ImpostoRenda parametroVerba) throws Exception {
//		parametroVerbaService.alterar(parametroVerba);		
		
		return "redirect:pesquisar";
	}
}
